import { BaseWindow } from "../../../../../component/window/BaseWindow";
import { ILayer } from "../../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../../extend/language/Language";
import { RuneGuideInfoPanel } from "./RuneGuideInfoPanel";
import { DataEvent } from "../../../../events/DataEvent";
import { RuneGuideShopPanel } from "./RuneGuideShopPanel";
import { EventName } from "../../../../mvc/EventName";
type int = number;
//class RuneGuidePanel
    
    export  class RuneGuidePanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(564, 424);
            title = Language.getString(30149);
            return;
        }

        /* internal  */showPanel(arg1: Object /* flash.display.Sprite */, arg2: Class): void
        {
            if (!arg1) 
            {
                arg1 = new arg2();
            }
            if (this._currentPanel && !(this._currentPanel == arg1)) 
            {
                if (this._currentPanel.parent) 
                {
                    this._currentPanel.parent.removeChild(this._currentPanel);
                }
            }
            if (!contains(arg1)) 
            {
                addChild(arg1);
            }
            this._currentPanel = arg1;
            if (typeof this._currentPanel === "runeguideinfopanel") 
            {
                setSize(564, 424);
            }
            else 
            {
                setSize(564, 388);
            }
            return;
        }

        /* internal  */onRuneShowItemHandler(arg1: DataEvent): void
        {
            this.showPanel(this._runeShop, RuneGuideShopPanel);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._runeInfo = new RuneGuideInfoPanel();
            this._runeInfo.addEventListener(EventName.RuneGuideShowItem, this.onRuneShowItemHandler);
            this._runeShop = new RuneGuideShopPanel();
            return;
        }

        protected /* override */ updateSize(): void
        {
            super.updateSize();
            _windowCenter.setSize(this.width - 22, this.height - titleHeight + 9);
            _windowCenter.x = 11;
            _windowCenter.y = 33;
            this._runeInfo.x = _windowCenter.x + 6;
            this._runeInfo.y = _windowCenter.y + 6;
            this._runeShop.x = this._runeInfo.x;
            this._runeShop.y = this._runeInfo.y;
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            this.showPanel(this._runeInfo, RuneGuideInfoPanel);
            return;
        }

        protected /* var */_runeInfo: RuneGuideInfoPanel;

        protected /* var */_runeShop: RuneGuideShopPanel;

        protected /* var */_currentPanel: Object /* flash.display.Sprite */;
    }
